<?php

namespace App\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\DeskRequest;
use App\Models\Desk;
use DB;

class DeskController extends Controller
{

    public function index()
    {
        $desks = DB::table("desks")->get();
        return $desks;
    }


    public function store(DeskRequest $request, Desk $desk)
    {
        $desk->fill($request->input())->save();
        return $this->message('创建成功');
    }


    public function show(Desk $desk)
    {
        return $desk;
    }


    public function edit(Desk $desk)
    {
        //
    }


    public function update(DeskRequest $request, Desk $desk)
    {
        $desk->update($request->input());
        return $this->message('修改成功');
    }


    public function destroy(Desk $desk)
    {
        $desk->delete();
        return $this->message('删除成功');
    }
}
